<%-- 
    Document   : SanPhamAdminContent
    Created on : Nov 1, 2011, 10:27:14 AM
    Author     : kijoo
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="MODEL.POJO.*"%>
<%@page import="java.util.ArrayList"%>
<%@page import="MODEL.DAO.LoaiSanPhamDAO"%>


<!DOCTYPE html>
<%
    String idloaisanpham = (String) request.getAttribute("IDLoaiSanPham");
    String tenloaisanpham = (String) request.getAttribute("TenLoaiSanPham");
    int soluongtrang = (Integer) request.getAttribute("SoTrang");
%>
<div id="dmchon">
    <strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=tenloaisanpham%>
    </strong>
</div> 
<div class="noidung"> 
    <table width="100%" border="0" align="center">
        <tr>   
            <td width="17%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Mã sản phẩm</td>
            <td width="57%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Tên sản phẩm</td>
            <td width="13%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Sửa</td>
            <td width="13%" align="center" bordercolor="#99FFCC" bgcolor="#CCCCCC">Xóa</td>
        </tr>
        <%
            ArrayList<ChiTietSanPhamPOJO> dsctsp = (ArrayList<ChiTietSanPhamPOJO>) request.getAttribute("DanhSachCTSPs");
            for (int j = 0; j < dsctsp.size(); j++) {
                ChiTietSanPhamPOJO ctsp = dsctsp.get(j);
        %>

        <tr>
            <td align="center"><%=ctsp.getIdsanpham()%></td>
            <td align="center"><%=ctsp.getTensanpham()%></td>  
            <td align="center"><a href="AdminController?Action=Sua&idchitietsanpham=<%=ctsp.getIdchitietsanpham()%>&idloaisanpham=<%= idloaisanpham%>&tenloaisanpham=<%= tenloaisanpham %>&Trang=1"><img src="images/edit_40b.png" width="16" height="16"></a></td>
            <td align="center"><a href="AdminController?Action=Xoa&idchitietsanpham=<%=ctsp.getIdchitietsanpham()%>&idloaisanpham=<%= idloaisanpham%>&tenloaisanpham=<%= tenloaisanpham %>&Trang=1"><img src="images/delete_button.gif" width="20" height="20"></a></td>
        </tr>

        <% }%>
    </table>
    <hr>
    <%
        if (request.getAttribute("GiaTriSua") == "1") {
            int idchitietsanphamsua =(Integer) request.getAttribute("IDChiTietSanPhamSua");
            ChiTietSanPhamPOJO ctspsua = (ChiTietSanPhamPOJO) request.getAttribute("ChiTietSanPhamSua");
    %>
    <form action="AdminController" method="get">
      <table width="69%" height="210" border="0" align="center">
            <tr>
                <td>Tên sản phẩm </td>
                <td><input name="txtTen" type="text" value="<%= ctspsua.getTensanpham()%>" size="50">
                    <input name="txtIDChiTietSP" type="hidden" value="<%= idchitietsanphamsua %>"/>
                    <input name="txtIDLoaiSP" type="hidden" value="<%= idloaisanpham %>"/>
                    
                </td>
            </tr>
            <tr>
                <td>Mô tả sản phẩm</td>
                <td><input name="txtMoTa" type="text" value="<%= ctspsua.getMota()%>" size="50"></td>
            </tr>
            <tr>
                <td>Hình </td>
                <td><input name="txtHinh" type="file" value="<%= ctspsua.getHinh() %>" ></td>
            </tr>
            <tr>
                <td>Giá bán</td>
                <td><input name="txtGia" type="text" value="<%= ctspsua.getGiaban()%>" size="40"></td>
            </tr>
            <tr>
              <td>Số lượng tồn</td>
                <td><input name="txtSoLuong" type="text" value="<%= ctspsua.getSoluongton()%>" size="40"></td>
            </tr>
            <tr>
                <td>Bảo hành</td>
                <td><input name="txtBaoHanh" type="text" value="<%= ctspsua.getBaohanh()%>" size="40"></td>
            </tr>
            <tr>
                <td>
                    <input type="submit" name="btSua" id="btSua" value="Sửa" style="background-color:#FFFF66">
                    <input name="txtTenLoaiSP" type="hidden" value="<%= tenloaisanpham %>">
                </td>
            </tr>
      </table>
    </form>

    <%
        }
    %>
    <%-- phan trang --%>

</div>
